import React from "react";
import { Layout, Menu } from "antd";
import { useNavigate, Outlet } from "react-router-dom";
import {
  DashboardOutlined,
  UserOutlined,
  FileOutlined,
  ShoppingCartOutlined,
  ProfileOutlined,
  FileTextOutlined,
  SettingOutlined,
} from "@ant-design/icons";

// import {useRoutes} from 'react-router-dom'
// import routes from './router/index.jsx'

const { Header, Sider, Content } = Layout;

const Index = () => {
  const navigate = useNavigate();
  // let element = useRoutes(routes)
  const menuItems = [
    { key: "dashboard", icon: <DashboardOutlined />, label: "仪表盘" },
    { key: "users", icon: <UserOutlined />, label: "用户管理" },
    { key: "fortunes", icon: <FileOutlined />, label: "测算管理" },
    // { key: "content", icon: <FileTextOutlined />, label: "内容管理" },
    { key: "orders", icon: <ShoppingCartOutlined />, label: "订单管理" },
    // { key: "profile", icon: <ProfileOutlined />, label: "用户画像" },
    // { key: "logs", icon: <FileTextOutlined />, label: "日志管理" },
    // { key: "settings", icon: <SettingOutlined />, label: "系统设置" },
  ];
  let gopage=(e)=>{
    console.log(e.key)
    navigate(e.key)
  }
  return (
    <Layout style={{ minHeight: "100vh" }}>
      <Header
        style={{
          background: "#fff",
          padding: "0 16px",
          boxShadow: "0 1px 4px rgba(0,21,41,0.08)",
        }}
      >
        <h1 style={{ margin: 0, float: "left" }}>后台管理系统</h1>
        <div style={{ float: "right" }}>
          <span></span>
        </div>
      </Header>
      <Layout>
        <Sider width={200} theme="light">
          <Menu
            mode="inline"
            defaultSelectedKeys={["dashboard"]}
            items={menuItems}
            onClick={(e) => {
              gopage(e);
            }}
          />
        </Sider>
        <Content style={{ padding: "16px", background: "#fff" }}>
            {/* <Outlet/> */}
            <Outlet />
            {/* <Layout/> */}
        </Content>
        {/* 32132231213 */}
      </Layout>
    </Layout>

  );
};

export default Index;
